home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / 3dvect39 / explode.asm < prev    next >
Encoding:
Assembly Source File  |  1994-10-30  |  3.6 KB  |  135 lines

  1. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  2. ;
  3. ; Filename     : explode.asm
  4. ; Included from: Main Assembley Module
  5. ; Description  : Explosion handler
  6. ;
  7. ; Written by: John McCarthy
  8. ;             1316 Redwood Lane
  9. ;             Pickering, Ontario.
  10. ;             Canada, Earth, Milky Way (for those out-of-towners)
  11. ;             L1X 1C5
  12. ;
  13. ; Internet/Usenet:  BRIAN.MCCARTHY@CANREM.COM
  14. ;         Fidonet:  Brian McCarthy 1:229/15
  15. ;   RIME/Relaynet: ->CRS
  16. ;
  17. ; Home phone, (905) 831-1944, don't call at 2 am eh!
  18. ;
  19. ; Send me your protected mode source code!
  20. ; Send me your Objects!
  21. ; But most of all, Send me a postcard!!!!
  22. ;
  23. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  24.  
  25.          .386p
  26.          jumps
  27.  
  28. code32   segment para public use32
  29.          assume cs:code32, ds:code32
  30.  
  31.          include pmode.ext                  ; protected mode externals by TRAN
  32.          include 3d.ext
  33.          include function.ext
  34.  
  35.          include macros.inc
  36.          include equ.inc
  37.  
  38.          public _handle_explosions
  39.          public _start_explosion
  40.  
  41. ex_off   dd maxobjects dup (0)
  42. ex_sx    dw maxobjects dup (0)
  43. ex_sy    dw maxobjects dup (0)
  44.  
  45. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  46. ; Start explosion
  47. ; In:
  48. ;  EDX => dw explosion table: dw bitmap#, xscale,yscale  (-1 terminated)
  49. ;   EBX - x location
  50. ;   ECX - y location
  51. ;   EBP - z location
  52. ;   SI => additional x scaling for explosion.
  53. ;   DI => additional y scaling for explosion.
  54. ; Out:
  55. ;  CS - no object free for explosion
  56. ;  CC - object exploded!
  57. ;   ESI => object # of explosion (in case you want to add velocity, whatever)
  58. ;
  59. ;Notes: an example of an explosion table:
  60. ;
  61. ; _explode_main1:
  62. ;         dw 15,140,140 ; bitmap number, x scale, y scale
  63. ;         dw 15,150,150
  64. ;         dw 15,160,160
  65. ;         dw 15,170,170
  66. ;         dw 13,180,180
  67. ;         dw 13,190,190
  68. ;         .
  69. ;         .
  70. ;         .
  71. ;         dw 7, 93, 93
  72. ;         dw 7, 90, 90
  73. ;         dw 7, 85, 85
  74. ;         dw 7, 80, 80
  75. ;         dw -1         ; end flag
  76. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  77.  
  78. _start_explosion:
  79.          push ebx ecx ebp esi edi edx
  80.          call _search_next_available_object
  81.          pop edx edi eax ebp ecx ebx
  82.          jc _ret
  83.  
  84.          mov ex_sx[esi*2],ax
  85.          mov ex_sy[esi*2],di
  86.          mov ex_off[esi*4],edx
  87.  
  88.          call _init_object
  89.          call _set_to_hi_bitmap
  90.          call _put_object
  91.  
  92. ex_update_esi:
  93.          mov edx,ex_off[esi*4]
  94.          mov ax,[edx]
  95.          cmp ax,-1
  96.          jz short ex_remove
  97.          mov _whatshape[esi*2],ax
  98.          mov ax,[edx+2]
  99.          add ax,ex_sx[esi*2]
  100.          mov _bitobjx[esi*2],ax
  101.          mov ax,[edx+4]
  102.          add ax,ex_sy[esi*2]
  103.          mov _bitobjy[esi*2],ax
  104.          add ex_off[esi*4],6
  105.          mov _onoff[esi],mainobject_on
  106.          clc
  107.          ret
  108.  
  109. ex_remove:
  110.          mov ex_off[esi*4],0
  111.          mov _onoff[esi],0
  112.          clc
  113.          ret
  114.  
  115. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  116. ; Handle explosions:
  117. ;
  118. ; Call this routine once per frame update to animate the explosions
  119. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  120.  
  121. _handle_explosions:
  122.          xor ebx,ebx
  123.          mov ecx,maxobjects
  124.          mov esi,ecx
  125. ex_loop:
  126.          dec esi
  127.          cmp ex_off[esi*4],ebx
  128.          loope short ex_loop
  129.          jcxz _ret
  130.          call ex_update_esi
  131.          jmp short ex_loop
  132.  
  133. code32   ends
  134.          end
  135.